package org.jeecg.common.util.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author guoyh
 * @ClassName DoctorAccountFlowStatusEnum
 * @Description
 * @since 2020/9/10 00:55
 **/
@Getter
@AllArgsConstructor
public enum DoctorAccountFlowStatusEnum {

    ING(0,"交易中", WithdrawRecordStatusEnum.APPLY),
    SUCCESS(0,"交易成功", WithdrawRecordStatusEnum.AGREE),
    FAIL(0,"交易失败", WithdrawRecordStatusEnum.REFUND),
    ;

    private int code;

    private String desc;

    private WithdrawRecordStatusEnum withdrawRecordStatus;


    public static DoctorAccountFlowStatusEnum getInstance(WithdrawRecordStatusEnum withdrawRecordStatus){
        return Arrays.stream(values()).filter(item -> Objects.equals(withdrawRecordStatus,item.getWithdrawRecordStatus())).findFirst().orElse(null);
    }
    public static DoctorAccountFlowStatusEnum getInstance(int code){
        return Arrays.stream(values()).filter(item -> Objects.equals(code,item.getCode())).findFirst().orElse(null);
    }
}
